extends StateBase


@onready var animationPlayer = $"../../WeaponAnimationPlayer"
@onready var weaponRoot:Node2D = $"../../WeaponRoot"


func enterState(ownerNode):
	pass
	
	
func exitState(ownerNode):
	pass
	
	
func process(delta, ownerNode:PlayerScript):
	if ownerNode.animations.animation != "Attack":
		ownerNode.animations.play("Attack")
		animationPlayer.play(ownerNode.currentWeapon + "Attack")
		if ownerNode.animations.flip_h:
			weaponRoot.scale.x = -1
		else:
			weaponRoot.scale.x = 1
		$DurationTimer.start()
		
	if $DurationTimer.time_left <= 0:
		stateMachine.changeState("StateNormal", ownerNode)
		if ownerNode.is_on_floor() and ownerNode.velocity.x != 0:
			ownerNode.velocity.x = 0
		
	
	
func physicsProcess(delta, ownerNode):
	pass
